package com.tmt.im.service.service;

import com.tmt.im.common.pojo.IMFriendPoJo;
import com.tmt.im.service.helper.IgniteQueryHelper;
import org.apache.ignite.Ignite;
import org.springframework.stereotype.Service;

import java.text.MessageFormat;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/10/11 0:49
 * @Version 1.0
 **/
@Service
public class FriendService extends BaseService {

    public FriendService(Ignite ignite) {
        super(ignite);
    }

    public IMFriendPoJo getFriendBy(Long ownerId, Long friendId){
        String sql = MessageFormat.format("select * from {0} where ownerId = ? and friendId = ?", IMFriendPoJo.CACHE_NAME);
        return IgniteQueryHelper.findOneBy(sql, new Object[]{ownerId, friendId}, IMFriendPoJo.class, friendCache);
    }
}
